<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCrmTargetTable extends Migration
{
    /**
     * Run the migrations.
     * 目标表
     * @return void
     */
    public function up()
    {
        //
        Schema::create('crm_target', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->comment='crm 目标表';
            $table->increments('id')->comment('自增键');
            $table->integer('crm_uid')->index('crm_uid')->unsigned()->default(0)->comment('crmUid');
            $table->date('date')->index('date')->comment('时间');
            $table->integer('target_volume_num')->default(0)->comment('目标月客户成交量');
            $table->decimal('target_money',9,2)->unsigned()->default(0.00)->comment('目标月业绩金额,最多百万');
            $table->integer('target_phone_num')->unsigned()->default(0)->comment('目标日电话通数');
            $table->integer('target_minutes_num')->unsigned()->default(0)->comment('目标月电话分钟数');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('类型,0表示月目标1.表示日目标');
            $table->integer('reviewer')->unsigned()->default(0)->comment('审核人');
            $table->string('remarks', 250)->default('')->comment('备注');
            $table->string('proposal', 250)->default('')->comment('审核建议');
            $table->tinyInteger('reviewer_status')->default(0)->comment('审核状态：1表示审核，0未审核');
            $table->integer('reference')->unsigned()->default(0)->comment('参考对象');
            $table->unique(['crm_uid','date']);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::drop('crm_target');
    }
}
